package org.zy;

import org.zy.model.Test;

/**
 * @author Zhang Yu
 * @description: TODO
 * @date 2024/4/28 7:54
 */
public class ThreadSyncDemo {
    private static Test test = new Test();
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 50000; i++) {
                test.add();
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 50000; i++) {
                test.add();
            }
        });
        t1.start();
        t2.start();

        t1.join();
        t2.join();
        System.out.println(test.getCount()
        );
    }
}
